import httpInstance from './http'

// 获取所有隐患点位
export function getPointsAllAPI() {
  return httpInstance({
    url: '/points/all',
  })
}

// 创建隐患点位
export function createPointAPI(data) {
  return httpInstance({
    url: '/points',
    method: 'POST',
    data,
  })
}

// 更新隐患点位
export function updatePointAPI(data) {
  return httpInstance({
    url: '/points',
    method: 'PUT',
    data,
  })
}

// 删除隐患点位
export function delPointAPI(id) {
  return httpInstance({
    url: `/points/${id}`,
    method: 'DELETE',
  })
}

// 获取所有隐患类别
export function getTypeAllAPI() {
  return httpInstance({
    url: '/types/all',
  })
}

// 新增类别
export function createTypeAPI(data) {
  return httpInstance({
    url: '/types',
    method: 'POST',
    data,
  })
}

// 删除类别
export function delTypeAPI(id) {
  return httpInstance({
    url: `/types/${id}`,
    method: 'DELETE',
  })
}

// 更新类别
export function updateTypeAPI(data) {
  return httpInstance({
    url: `/types`,
    method: 'PUT',
    data,
  })
}

// 上传图片
export function uploadImgAPI(file) {
  return httpInstance({
    url: '/points/upload',
    method: 'POST',
    data: file,
  })
}

export function uploadImgByIdAPI(id, file) {
  return httpInstance({
    url: `/points/uploadById/${id}`,
    method: 'POST',
    data: file,
  })
}

export function uploadExcel(file) {
  return httpInstance({
    url: '/points/uploadExcel',
    method: 'POST',
    data: file,
  })
}
